﻿using System;
using System.Data.Common;

namespace MingYuanYun.Data.Abstractions 
{
    internal class ReflectionDriveConnectionProvider
    {
	    private readonly Type _connectionType;

	    public ReflectionDriveConnectionProvider(Type connectionType)
	    {
		    this._connectionType = connectionType ?? throw new ArgumentNullException(nameof(connectionType));
	    }

	    public DbConnection CreateConnection()
	    {
		    return (DbConnection) Activator.CreateInstance(_connectionType);
	    }
    }
}
